
******************************
* Figure 6
******************************
clear all 

set obs 6  // Set the number of observations for roll1 (0 to 5)
gen roll1 = _n - 1  // Create roll1 variable (0 to 5)

tempfile tempdata
save `tempdata'  // Save this temp data

clear
set obs 6  // Set the number of observations for roll2 (0 to 5)
gen roll2 = _n - 1  // Create roll2 variable (0 to 5)

gen byte dummy = 1  // Add a dummy variable for merging
tempfile tempdata2
save `tempdata2'

clear
use `tempdata'
gen byte dummy = 1
joinby dummy using `tempdata2'  // Create all combinations of roll1 and roll2
drop dummy  // Remove the dummy variable

// Display the final dataset
sort roll1 roll2 

egen report1=rowmax(roll1 roll2)
egen report2=rowmin(roll1 roll2)

drop roll*
rename report* roll*
gen treat=31
append using "data/both.dta"



foreach i of numlist  11 12 13 14 21 22 31 {
qui: eststo: mean roll2 if treat==`i', over(roll1)
}

* colapse data to make summary data
collapse roll2 , by(roll1 treat)


tw  (line roll2 roll1 if treat==21) (line roll2 roll1 if treat==22) (line roll2 roll1 if treat==31, lp(dash)) /// 
, yline(2.5) xtitle("Report 1") ytitle("Average of Report 2") legend(off) scale(1.2) /// 
text(2.3 5.7 "JD Prediction", ju(left)) text(3.2 5.7 "Two Screen", ju(left)) ///
text(3.45 5.7 "One Screen", ju(left)) text(2.5 5.7 "Chance", ju(left)) graphregion(margin(2 30 2 2))

graph export "output/figure6.pdf", as(pdf) name("Graph") replace

